import React from 'react'
import { useLgContext } from '../userContext'
import {message} from 'antd'
import './MyHead.css'
import { withRouter } from 'react-router-dom'


const MyHead = (props) => {
    const {state} = useLgContext();
    const logout=()=>{
        // clearToken();
        // clearUserName();
        props.history.replace('/login');
        message.success('退出成功')
    }
    return (
    <div className="toubu">
        <h1>国瓷后台管理系统</h1>
        {/* <span className='name'>{state.username}</span> */}
        <div className='you'>
        <span className='name'>用户名</span>
        <span className='outlog' onClick={logout}>退出登录</span>
        </div>
    </div>
  )
}

export default withRouter(MyHead)